<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="./js/angular.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myAppControl">
	<div ng-app="appOne" ng-controller="appOneControl">
		{{username}}
		{{allUser}} <!-- 实现数据共享 -->
		{{rootUser}}
	</div>
	<div ng-app="appTwo" ng-controller="appTwoControl">
		{{username}}
		{{rootUser}}
	</div>
	{{username}}
</body>
<script type="text/javascript">
var appOne = angular.module('appOne',[]);
appOne.controller('appOneControl',function($scope){
	$scope.username = "张三";
});
var appTwo = angular.module('appTwo',[]);
appTwo.controller('appTwoControl',function($scope,$rootScope){
	$scope.username = "李四";
	$rootScope.rootUser = "李连杰";
});
var myApp = angular.module('myApp',['appOne','appTwo']);
myApp.controller('myAppControl',function($scope,$rootScope){
	$scope.username = "王五";
	$scope.allUser = "赵二";
	$rootScope.rootUser = "赵子龙";
});
</script>
</html>